<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    var on = new Promise((resolve, reject) => {
        setTimeout(() => {
            reject(8888);
        }, 2000)
    })

    on.then((res) => {
        console.log("Promise对象的状态变为 finished  成功");
    }).catch((err) => {
        console.log("Promise对象的状态变为 rejected  失败");
    }).finally(() => {
        console.log("Promise对象的状态终止(结束)");
    })
</script>